<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>cesium宇宙背景透明</title>
</head>
<!--Cesium js文件引入 -->
<script src="./js/earthsdk.js"></script>
<!-- 自定义Css样式 -->
<link rel="stylesheet" href="./css/example1.css" />

<style>
    html,
    body {
        width: 100%;
        height: 100%;
        margin: 0px;
        padding: 0px;
    }

    #app {
        position: relative;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    button {
        position: absolute;
        top: 10px;
        left: 10px;
        z-index: 999;
    }
</style>

<body>
    <div id="app"></div>

    <script>
        /** -----------------------------------------地球创建----------------------------------------------------**/

        // Vue中引入方式：import { ESObjectsManager } from 'earthsdk3';
        const { ESObjectsManager } = window['EarthSDK3']
        const { ESCesiumViewer } = window['EarthSDK3_Cesium']
        const { ESUeViewer } = window['EarthSDK3_UE']
        const objm = new ESObjectsManager(ESCesiumViewer, ESUeViewer);
        window.g_objm = objm;
        // 监听视口状态
        objm.viewerCreatedEvent.don((v) => {
            // 获取Cesium底层viewer
            const viewer = v.viewer;
            viewer.scene.skyBox.show = false;
            //地球颜色
            v.sceneGlobeBaseColor = [1, 0, 0, 1]
            //背景颜色
            viewer.scene.backgroundColor = new Cesium.Color(1.0, 1.0, 0.0, 1.0);
        });
        // 创建Cesium视口
        const viewer = objm.createCesiumViewer(document.getElementById("app"));
        // 通过json创建一个影像图层
        // const imageryLayer = objm.createSceneObjectFromJson({
        //     id: "9812a65f-0de0-4f7b-b234-809c0c2fb8ef",
        //     type: "ESImageryLayer",
        //     url: "https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
        // });


    </script>
</body>

</html>